<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>佐心，教家长做父母</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="assets/css/amazeui.min.css">
    <link rel="stylesheet" href="assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="assets/css/index.css?v=2.3">
    <script>
    	    /** 
     * 返回前一页（或关闭本页面） 
     * <li>如果没有前一页历史，则直接关闭当前页面</li> 
     */  
    function goBack(){  
        if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)){ // IE  
            if(history.length > 0){  
                window.history.go( -1 );  
            }else{  
                location.href="${ctx}/index.jsp";
            }  
        }else{ //非IE浏览器  
            if (navigator.userAgent.indexOf('Firefox') >= 0 ||  
                navigator.userAgent.indexOf('Opera') >= 0 ||  
                navigator.userAgent.indexOf('Safari') >= 0 ||  
                navigator.userAgent.indexOf('Chrome') >= 0 ||  
                navigator.userAgent.indexOf('WebKit') >= 0){  
      
                if(window.history.length > 1){  
                    window.history.go( -1 );  
                }else{  
                    location.href="${ctx}/index.jsp";
                }  
            }else{ //未知的浏览器  
                window.history.go( -1 );  
            }  
        }  
    }  
    </script>
</head>
<body class="bg-white">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a  onclick="goBack();"  >
            <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        全部评论
    </h1>
    <div class="am-header-right am-header-nav am-text-right" id="pj1">
        
    </div>
</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">
    <div class=" am-padding-bottom-sm">
        <div class="mark_lists">

            <div class="am-list-news am-list-news-default ">

                <div class="am-list-news-bd am-margin-left-sm am-margin-right-sm">
                    <ul class="am-list ">
                    </ul>
                </div>

            </div>



        </div>
    </div>



</section>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script>
$(function () {
	
		var isHuifuResponse=$.ajax({url:"isHuifuPeixun?studyId=${param.studyId}",async:false});
		var isPingjiaJson=JSON.parse(isHuifuResponse.responseText);
		if(isPingjiaJson.resultCode==0){
			$("#pj1").html("<a href='myPeixunPingjia.jsp?studyId=${param.studyId}&orderSn="+isPingjiaJson.resultDesc+"'>评价</a>");
		}else if(isPingjiaJson.resultCode==1){
			$("#pj1").html("<a>已评价</a>");
		}else{
			$("#pj1").html("");
		}
		
    	var baseResponse=$.ajax({url:"getPeiPingjia?studyId=${param.studyId}",async:false});
    	var pingjiaJson=JSON.parse(baseResponse.responseText);
    	if(pingjiaJson.resultCode=="0"){
		   var html="";
		   var xunhuancishu=500;
		   if(pingjiaJson.pingjiaList.length<=500){
		   	  xunhuancishu=pingjiaJson.pingjiaList.length;
		   }
		   $("#pingjiaCount").text(pingjiaJson.pingjiaList.length);
		   if(xunhuancishu>0){
		   for(var i=0;i<xunhuancishu;i++){
		   	  html+="<li class='am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left'>";
              html+="              <div class=' am-u-sm-12 am-list-main font-14 box'>";
              html+="                  <div class='width-60px'>";
              html+="                      <a class=''>";
              html+="                          <img class='img-50' src='"+pingjiaJson.pingjiaList[i].headUrl+"'/>";
              html+="                      </a>";
              html+="                 </div>";
              html+="                  <div class='box-1 margin-top-5'>";
              html+="                      <h3 class='am-list-item-hd font-color-main'>";
              html+="                          <div class='am-g am-g-collapse'>";
              html+="                              <div class='am-u-sm-8'><span";
              html+="                                      class='font-color-13 font-15 font-bold'>"+pingjiaJson.pingjiaList[i].nickName+"</span>";
              html+="                              </div>";
              html+="                              <div class='am-u-sm-4 font-color-16  padding-top-2pxs am-text-right'>";
              html+=pingjiaJson.pingjiaList[i].pingjiaTime.substr(0,10);
              html+="                              </div>";
              html+="                          </div>";
              html+="                      </h3>";
              html+="                      <div class='font-14 font-color-13 '>";
              html+="                          <span class='am-fl font-color-15'>评分：</span>";
              
              var html2="";
              for(var j=0;j<pingjiaJson.pingjiaList[i].pingjiaxx;j++){
              	  html2+="                          <i class='star-cur'></i>";
              }
              html+=html2;
              html+="                      </div>";
              html+="                  </div>";
              html+="              </div>";
              html+="              <div class=' am-u-sm-12 am-list-main font-14 font-color-15 am-margin-top-xs'>";
              html+=pingjiaJson.pingjiaList[i].pingjia;
              html+="              </div>";
              html+="          </li>";
		   }
		   }else{
		   	  html="<div class='icon_55'></div>";
              html+="<div class='am-text-center font-14 font-color-15'>暂无评论，快点击评论按钮，抢沙发吧！</div>";
              $("#allPingjia").hide();
		   }
		   $(".am-list").html(html);
	   	}
});
</script>
</body>
</html>